<?php

/**
 * Question form.
 *
 * @package    elearning
 * @subpackage form
 * @author     Your name here
 */
class QuestionForm extends BaseQuestionForm
{
  public function configure()
  {
  		unset( $this['created_at'], $this['updated_at'] );
 		$this->validatorSchema['question_status'] =  new sfValidatorInteger( array('required' => false ));
		$question = $this->getObject();
		if( $question->getQuestionStatus() == 0 )
			$question->setQuestionStatus(NULL);
		$this->widgetSchema['question_status'] = new sfWidgetFormInputCheckbox(array("value_attribute_value" => 1),array('value' => 1));
		//$this->widgetSchema['test_status'] = new sfWidgetFormInputCheckbox();
		$this->widgetSchema['question_content'] = new sfWidgetFormTextareaTinyMCE(array(
		  'width'  => 500,
		  'height' => 300,
		  'config' => 'theme_advanced_disable: "anchor,image,cleanup,help"',
		));
		//$question = $this->getObject();
		//$question->setQuestionContent("heheheheh");
		//$answerObject = new QuestionAnswer();
		//retrieveByPK($pk, PropelPDO $con = null)
		
		//$answerObject.setId() = 
		//$answer = new QuestionAnswerForm(  );
		/*
		$this->widgetSchema['question_answer'] = new sfWidgetFormTextareaTinyMCE(array(
		  'width'  => 500,
		  'height' => 300,
		  'config' => 'theme_advanced_disable: "anchor,image,cleanup,help"',
		));	
		*/
		
	    $this->widgetSchema->setNameFormat('question[%s]');
		//code de cho hien thi * o cac truong require cung add them 2 dong o backend.css
		$decorator = new sidFormFormatter($this->widgetSchema, $this->validatorSchema);
		$this->widgetSchema->addFormFormatter('custom', $decorator);
		$this->widgetSchema->setFormFormatterName('custom');
  }
}
